library ViewCommand initializer init requires LegacySystem, CameraEffectSystem


	private function ViewSet takes nothing returns boolean
		local string s = SubString(GetEventPlayerChatString(),6,StringLength(GetEventPlayerChatString()))
		local integer view = S2I(s)
		local player p = GetTriggerPlayer()
		
		if view >= 300 and view <=1000 then
			call SetCustomAngle(p, view)
		elseif view == 1 then
			call SetCustomAngle(p, -1)
		elseif view == 2 then
			call SetCustomAngle(p, 800)
		elseif view == 3 then
			call SetCustomAngle(p, 900)
		else
			call DisplayTimedTextToPlayer(p, 0.0, 0.0, 5.0, "View set must be 1, 2, 3, or a value between 300 and 1000")
		endif
		set p = null
		return false
	endfunction
	
	private function init takes nothing returns nothing
		local trigger t
		local integer i = 0
		set t = CreateTrigger()
		loop
			exitwhen i > 11
			call TriggerRegisterPlayerChatEvent(t, Player(i), "-view ", false)
			set i = i + 1
		endloop
		call TriggerAddCondition(t, Condition(function ViewSet))
	endfunction
endlibrary

